<?php
header("Expires: Sat, 1 Jan 2005 00:00:00 GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

?><html>
<head>
<title>try</title>
<script type="text/javascript">
function loadPage()
{
	/*
	var JOload = getPage('json_get.php', function() 
	{
		alert(JOc.result[0]['text']);
		JOc.result.query("SELECT * WHERE text = 'YouTube'");
	});
	//*/
}
</script>
<script type="text/javascript" src="scripts/json.js"></script>
</head>
<body onload="loadPage()">
<div id="json">
</div>
<div id="output">
<script type="text/javascript">
getPage('json_get.php', function() 
{
	var data = JOc.result;  														// working
	// var data = JOc.result.query("SELECT url WHERE text = 'YouTube' OR id = 2"); 	// working
	// var data = JOc.result.where("text = 'YouTube' OR id = 1");  					// working
	// var data = JOc.result.where("text = 'YouTube' OR id = 2").select("url");		// working
	// var data = JOc.result   														// not working jet
		// .select("id, text")
		// .where("id = 1")
		// .and("text LIKE 'goog') != -1");
	
	// two times the same action: 
	// first time:
	for (i = 0; i < data.length; i++)
	{
		document.getElementById("output").innerHTML += (data[i]["id"] + " : " + data[i]["text"] + "<br/>&nbsp;&nbsp;&nbsp;" + data[i]["url"] + "<br/>");
	}
	
	// second time:
	outputData("json", data, "[id] : [text]<br/>&nbsp;&nbsp;&nbsp;[url]<br/>");
	
	// output in a table:
	//outputData("json", data, '<table>\n\t<tr>\n\t\t<th>id</th>\n\t\t<th>text</th>\n\t\t<th>url</th>\n\t</tr>\n{\t<tr>\n\t\t<th>[id]</th>\n\t\t<th>[text]</th>\n\t\t<th>[url]</th>\n\t</tr>\n}</table>');
});
</script>
</div>
</body>
</html>